package ProcessingAudioWindows;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;

public class T1AudioProcessingWindow extends AudioProcessingWindow {

    private JRadioButton option1;
    private JRadioButton option2;
    private JRadioButton option3;
    private JCheckBox chckbxNewCheckBox;
    private JCheckBox chckbxNewCheckBox2;
    private JTextField filterField;
    /**
     * Create the application.
     * @wbp.parser.constructor
     */
    public T1AudioProcessingWindow() {
        super();
        initialize();
    }
    
    public T1AudioProcessingWindow(int x, int y) {
        super(x, y);
        initialize();
    }

    /**
     * Initialize the contents of the frame.
     */
    private void initialize() {   
        frame = new JFrame();
        frame.setBounds( 100, 100, 450, 300 );
        
        JButton btnOk = new JButton("Ok");
        btnOk.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                frame.setVisible( false );
            }
        });
        frame.getContentPane().add(btnOk, BorderLayout.SOUTH);
        
        JPanel panel = new JPanel();
        frame.getContentPane().add(panel, BorderLayout.NORTH);
       panel.setLayout(new GridLayout(6, 1));
       
       option1 = new JRadioButton("Analiza przejść przez zero");
       option2 = new JRadioButton("Zliczanie maksimów");
       option3 = new JRadioButton("Analiza przejść przez wartość progową ");
       filterField = new JTextField(4);
       filterField.setText("330");
       ButtonGroup bg = new ButtonGroup();
       bg.add(option1);
       bg.add(option2);
       bg.add(option3);     

       panel.add(option1);
       panel.add(option2);
       panel.add(option3);
       chckbxNewCheckBox = new JCheckBox("Wykryj tony");
       panel.add(chckbxNewCheckBox);
       chckbxNewCheckBox2 = new JCheckBox("Filtracja");
       panel.add(chckbxNewCheckBox2);
       panel.add(filterField);
       option1.setSelected(true);
    
       frame.setLocation( x, y );
    }

	public JRadioButton getOption1() {
		return option1;
	}

	public JRadioButton getOption2() {
		return option2;
	}

	public JRadioButton getOption3() {
		return option3;
	}

	public boolean isDetectNotes() {
        return chckbxNewCheckBox.isSelected();
    }
    
	public boolean isFIlterActive() {
        return chckbxNewCheckBox2.isSelected();
    }
	
	public double getSRate() {
		return Double.parseDouble(filterField.getText());
	}

}
